package com.gooagoo.supercrm;

import android.content.Context;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.widget.TextView;

import com.gooagoo.supercrm.base.BaseActivity;
import com.gooagoo.supercrm.base.MvpView;
import com.gooagoo.supercrm.update.FirUpdater;
import com.gooagoo.supercrm.widget.badge.Badge;
import com.gooagoo.supercrm.widget.badge.QBadgeView;
import com.tencent.tinker.lib.library.TinkerLoadLibrary;
import com.tencent.tinker.lib.tinker.Tinker;
import com.tencent.tinker.lib.tinker.TinkerInstaller;
import com.tencent.tinker.loader.shareutil.ShareTinkerInternals;

import org.apache.log4j.Logger;

import butterknife.BindView;
import butterknife.OnClick;

public class MainActivity extends BaseActivity implements MvpView {
    private static Logger logger =Logger.getLogger(MainActivity.class);
    private FirUpdater firUpdater;

    @BindView(R.id.tv_my_lianmeng) TextView tv_my_lianmeng;
//    @BindView(R.id.tv)  TextView tv;
    private Badge badge;

//    @OnClick(R.id.tv)
//     void  test(){
//
//            showToast("呵呵呵");
//            new Thread(){
//                @Override
//                public void run() {
//                    try {
//                        Thread.sleep(5000);
//                    } catch (InterruptedException e) {
//                        e.printStackTrace();
//                    }
//                    showToast("子线程哦");
//                }
//            }.start();
//    }

    @Override
    protected int setContentView() {
        return R.layout.activity_home;
    }

    @Override
    protected void init() {
//        firUpdater = new FirUpdater(mContext);
//        firUpdater.apiToken("")
//                .appId("")
//                .checkVersion();
//
//        tv.setText("哈哈哈");
        badge = new QBadgeView(mContext).bindTarget(tv_my_lianmeng);
        badge.setBadgeNumber(100);
        logger.info("init  come");
        //加载
//        TinkerInstaller.onReceiveUpgradePatch(getApplicationContext(), Environment.getExternalStorageDirectory().getAbsolutePath() + "/patch_signed_7zip.apk");
//        TinkerLoadLibrary.installNavitveLibraryABI(getApplicationContext(), "armeabi");
//        ShareTinkerInternals.killAllOtherProcess(getApplicationContext());
//        android.os.Process.killProcess(android.os.Process.myPid());
//        Tinker.with(getApplicationContext()).cleanPatch();
    }

    @Override
    public void showData(String data) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showErr() {

    }

    @Override
    public Context getContext() {
        return mContext;
    }
}